package cardwall.client;

import org.puremvc.java.multicore.patterns.facade.Facade;
import org.puremvc.java.multicore.interfaces.IFacade;
import cardwall.client.controller.StartupCommand;

/**
 * @author $LastChangedBy: vogensen $
 * @version $Revision: 2 $
 */
public class ApplicationFacade extends Facade implements IFacade {

    // Notifications
    public static final String STARTUP = "startup";
    public static final String TASKS_CHANGED = "tasks refreshed";
    public static final String SELECTION_CHANGED = "selection changed";
    public static final String WINDOW_RESIZED = "window resized";
    public static final String EDITTASK = "edit task";

    public static final String NOTIFICATIONTYPE_DEFAULT = "default";

    private static ApplicationFacade instance;

    private ApplicationFacade() {
        super("main");
    }

    public static ApplicationFacade getInstance() {
        if(instance == null) {
            instance = new ApplicationFacade();
        }
        return instance;
    }

    protected void initializeController() {
        super.initializeController();
        registerCommand(STARTUP, new StartupCommand());
    }

    public void startup(CardWall app) {
        System.out.println("ApplicationFacade fires \"" + STARTUP + "\"");
        sendNotification(STARTUP, app, NOTIFICATIONTYPE_DEFAULT);
    }
}
